package Day010_排序算法_异常.demo07_自定义异常.自定义异常练习;

/**
 * @Author：pengzhilin
 * @Date: 2020/4/27 14:54
 */
public class Test {
    public static void main(String[] args) {
        //Student stu1 = new Student("张三", -18);
        //System.out.println(stu1.getAge());//

        Student stu2 = new Student();
        stu2.setAge(-2);
        System.out.println(stu2.getAge());
    }

    public static int method1(){
        int num = 10;
        try {
            System.out.println(1/0);
        } catch (Exception e) {
            num = 20;
            return num;
        } finally {
            num = 30;
            return num;
        }
    }

    public static int method2(){
        int num = 10;
        try {
            System.out.println(1/0);
        } catch (Exception e) {
            num = 20;
            return num;
        } finally {
            num = 30;
        }
        return num;
    }
}
